//
//  SendRedPaperView.m
//  LiveStar
//
//  Created by 漪珊 on 2016/12/21.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "SendRedPaperView.h"

@implementation SendRedPaperView

- (void)awakeFromNib {
    [super awakeFromNib];
    self.backgroundColor = [UIColor colorWithPatternImage:kSET_IMAGE(@"SendRedPaperBackImage")];
    self.moneyTextField.text = @"";
    self.membersTextField.text = @"";
    self.sendBtn.enabled = NO;
    self.paperType = RedPaperEqualType;//默认均分红包
    [self ChoiceRedPaperType:self.equalBtn];
    kButtonRadius(self.sendBtn, self.sendBtn.height/2);
}

//发红包
- (IBAction)SendRedPaper:(id)sender {
    [self.delegate sendRedPapepr:self];
}

//选择红包类型
- (IBAction)ChoiceRedPaperType:(id)sender {
    if (sender == self.equalBtn) {
        self.paperType = RedPaperEqualType;
        [self.equalBtn setImage:[UIImage imageNamed:@"redSend_selected"] forState:UIControlStateNormal];
        [self.randomBtn setImage:[UIImage imageNamed:@"redSend_normal"] forState:UIControlStateNormal];
        self.moneyTextField.placeholder = @"请输入单个红包金额";
    } else {
        self.paperType = RedPaperRandomType;
        [self.randomBtn setImage:[UIImage imageNamed:@"redSend_selected"] forState:UIControlStateNormal];
        [self.equalBtn setImage:[UIImage imageNamed:@"redSend_normal"] forState:UIControlStateNormal];
        self.moneyTextField.placeholder = @"请输入随机红包总金额";
    }
}

// 关闭发红包界面
- (IBAction)closeSendRedPaperTip:(id)sender {
    [self.delegate closeRedPaperView];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
